package com.yanfan.ccapicode.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yanfan.ccapicode.dao.CustomMappingRepository;
import com.yanfan.ccapicode.dao.base.repository.BaseRepository;
import com.yanfan.ccapicode.dao.entity.CustomMappingDO;
import com.yanfan.ccapicode.dao.mapper.CustomMappingMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * :)
 *
 */
@Repository
public class CustomMappingRepositoryImpl extends BaseRepository<CustomMappingMapper, CustomMappingDO,Object> implements CustomMappingRepository {

    @Override
    public CustomMappingDO selectByProductThirdCode(String productId, String thirdCode) {
        LambdaQueryWrapper<CustomMappingDO> lambda = new QueryWrapper<CustomMappingDO>().lambda();
        lambda.eq(CustomMappingDO::getProductId,productId);
        lambda.eq(CustomMappingDO::getThirdSignCode,thirdCode);
        return this.baseMapper.selectOne(lambda);
    }

    /**
     * 查询自定义映射模板
     *
     * @param id 自定义映射模板主键
     * @return 自定义映射模板
     */
    @Override
    public CustomMappingDO selectCcapiCustomMappingById(Long id) {
        return baseMapper.selectCcapiCustomMappingById(id);
    }

    /**
     * 查询自定义映射模板列表
     *
     * @param ccapiCustomMapping 自定义映射模板
     * @return 自定义映射模板
     */
    @Override
    public List<CustomMappingDO> selectCcapiCustomMappingList(CustomMappingDO ccapiCustomMapping) {
        return baseMapper.selectCcapiCustomMappingList(ccapiCustomMapping);
    }
}
